
# Severity in ug3

# Justice prefs 

jp_1 <- lm(more_severe_punishment ~ woman + community, ug3) 
jp_2 <- lm(punish_then_and_there ~ woman + community, ug3) 
jp_3 <- lm(sfmv ~ woman + more_severe_punishment + community, ug3) 
jp_4 <- lm(sfmv ~ woman + punish_then_and_there + community, ug3) 
jp_5 <- lm(sfmv ~ woman + punish_then_and_there + more_severe_punishment + community, ug3) 

# Get HC1 robust standard errors from estimatr package
ses<- starprep(jp_1,
               jp_2,
               jp_3,
               jp_4,
               jp_5, stat = "std.error",se_type = "HC1")

pvals<- starprep(jp_1,
                 jp_2,
                 jp_3,
                 jp_4,
                 jp_5, stat = "p.value",se_type = "HC1")


sink("04_manuscript/tables/justice_prefs.tex")
stargazer(
  jp_1,
  jp_2,
  jp_3,
  jp_4,
  jp_5,
  se = ses,
  p = pvals,
  # type = "text",
  no.space = TRUE,
  covariate.labels = c("Woman", "Should punish more severely","Should punish more swiftly"),
  dep.var.labels = c("Should punish more severely","Should punish more swiftly","Mob Should Beat Thief"),
  # "Mob Should Kill Thief"),
  # "Mob Should Beat Thief","Mob Should Kill Thief",
  # "Mob Should Beat Thief","Mob Should Kill Thief"
  # ),
  add.lines = list(c("Avg. men", 
                     with(subset(ug3, woman == 0), round(mean(more_severe_punishment, na.rm = TRUE),2)),
                     with(subset(ug3, woman == 0), round(mean(punish_then_and_there, na.rm = TRUE),2)),
                     with(subset(ug3, woman == 0), round(mean(sfmv, na.rm = TRUE),2)),
                     with(subset(ug3, woman == 0), round(mean(sfmv, na.rm = TRUE),2)),
                     with(subset(ug3, woman == 0), round(mean(sfmv, na.rm = TRUE),2))
  )
  ),
  omit.stat = c("rsq","f","ser"),
  omit = c("Constant","community"),
  float = FALSE
)
sink()



rm(jp_1,
   jp_2,
   jp_3,
   jp_4,
   jp_5,ses,pvals)













